﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MyDMS.BusinessLayer;
using System.Data;

public partial class admin_Default : PageBaseClass
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Office o = new OfficeFactory().GetByPrimaryKey(new OfficeKeys(_author.office_Code));
        lblOfficeName.Text = o.Office_Name;
        lblOfficeEmail.Text = o.Account_Email;

        object dataObject;
        new SqlFactory().ExecuteQuery("select count(*) from UserInfo ui " +
        " inner join JobDescription jd on ui.JD_Code=jd.JD_Code" +
        " where jd.Office_Code = " + _author.office_Code, out dataObject, SqlFactory.DataObjectType.DataSet);

        if (dataObject != null)
        {
            lblTotUsers.Text = ((DataSet)dataObject).Tables[0].Rows[0][0].ToString();
        }

        dataObject = null;
        new SqlFactory().ExecuteQuery("select count(*) from Project p " +
        " where p.Office_Code = " + _author.office_Code, out dataObject, SqlFactory.DataObjectType.DataSet);

        if (dataObject != null)
        {
            lblTotProjects.Text = ((DataSet)dataObject).Tables[0].Rows[0][0].ToString();
        }

        dataObject = null;
        new SqlFactory().ExecuteQuery("select count(*) from UploadedDocument ud " +
        " where ud.Office_Code = " + _author.office_Code, out dataObject, SqlFactory.DataObjectType.DataSet);

        if (dataObject != null)
        {
            lblTotDocuments.Text = ((DataSet)dataObject).Tables[0].Rows[0][0].ToString();
        }
    }
}
